package com.kehutong.auth.entity;

import com.kehutong.auth.enums.AccountStatus;
import com.kehutong.auth.enums.RegChannel;
import com.kehutong.common.enums.Gender;
import org.coraframework.json.annotation.JSONField;
import org.coraframework.orm.Entity;
import org.coraframework.orm.annotation.Column;
import org.coraframework.orm.annotation.KeyType;
import org.coraframework.orm.annotation.Table;
import org.coraframework.orm.annotation.UnSave;

import java.sql.Timestamp;
import java.util.List;

/**
 * 账户信息
 * 注意(账户的编号等价于客户通住户编号)
 * @author: liukunlong
 * @date: 2021-04-08 14:29
 */
@Table(value = "t_account", comment="账户信息")
public class Account extends Entity {
    private static final long serialVersionUID = 296129229105462474L;

    protected Account(String id) {
        super(id);
    }

    @Column(length = 64, comment = "账户", key = KeyType.KEY_UNIQUE)
    private String account;

    @Column(length = 64, comment = "密码")
    private String password;

    @Column(length = 64, comment = "支付密码")
    private String payPassword;

    @Column(length = 64, comment = "昵称")
    private String nickName;

    @Column(comment = "姓名")
    private String realname;

    @Column(comment = "性别")
    private Gender gender;

    @Column(length = 255, comment = "头像")
    private String avatar;

    @Column(comment = "手机号", key = KeyType.KEY_UNIQUE)
    private String mobile;

    @Column(comment = "手机号是否有效 0无效 1有效")
    private boolean mobileValid;

    @Column(comment = "邮箱", key = KeyType.KEY_UNIQUE)
    private String email;

    @Column(comment = "邮箱验证")
    private boolean emailValid;

    @Column(comment = "身份证",key = KeyType.KEY_UNIQUE)
    private String idCard;


    @Column(comment = "微信号")
    private String weixinNo;

    @Column(comment = "生日")
    private String birthDay;

    @Column(comment = "职业")
    private String offerName;

    @Column(length = 127, comment = "个性签名")
    private String signature;

    @Column(length = 127, comment = "描述")
    private String remark;

    @Column(comment = "地址")
    private String address;

    @Column(length = 64, comment = "国家")
    private String country;

    @Column(length = 64, comment = "省")
    private String province;

    @Column(length = 64, comment = "市")
    private String city;

    @Column(length = 64, comment = "语言")
    private String language;

    @Column(comment = "激活状态")
    private AccountStatus status;

    @Column(comment = "账户绑定的客户通企业编号")
    private List<String> khtIds;

    @Column(length = 64, comment = "最近登录IP")
    private String lastLoginIp;

    //最后登录时间
    @UnSave
    @JSONField (format="yyyy-MM-dd HH:mm:ss")
    private Timestamp lastLoginTime;

    @Column(comment = "注册渠道")
    private RegChannel regChannel;


    //关联小区数量
    @UnSave
    private long communityCount;

    //关联小区名称
    @UnSave
    private String communityName;


    //物业公司住户信息是否启用禁用
    @UnSave
    private boolean enable;

    /***
     * 验证码
     */
    private String code;

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPayPassword() {
        return payPassword;
    }

    public void setPayPassword(String payPassword) {
        this.payPassword = payPassword;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public boolean isMobileValid() {
        return mobileValid;
    }

    public void setMobileValid(boolean mobileValid) {
        this.mobileValid = mobileValid;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public boolean isEmailValid() {
        return emailValid;
    }

    public void setEmailValid(boolean emailValid) {
        this.emailValid = emailValid;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public AccountStatus getStatus() {
        return status;
    }

    public void setStatus(AccountStatus status) {
        this.status = status;
    }

    public List<String> getKhtIds() {
        return khtIds;
    }

    public void setKhtIds(List<String> khtIds) {
        this.khtIds = khtIds;
    }

    public String getLastLoginIp() {
        return lastLoginIp;
    }

    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }


    public Gender getGender() {
        return gender;
    }

    public void setGender(Gender gender) {
        this.gender = gender;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }

    public String getWeixinNo() {
        return weixinNo;
    }

    public void setWeixinNo(String weixinNo) {
        this.weixinNo = weixinNo;
    }

    public String getBirthDay() {
        return birthDay;
    }

    public void setBirthDay(String birthDay) {
        this.birthDay = birthDay;
    }

    public String getOfferName() {
        return offerName;
    }

    public void setOfferName(String offerName) {
        this.offerName = offerName;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public RegChannel getRegChannel() {
        return regChannel;
    }

    public void setRegChannel(RegChannel regChannel) {
        this.regChannel = regChannel;
    }


    public long getCommunityCount() {
        return communityCount;
    }

    public void setCommunityCount(long communityCount) {
        this.communityCount = communityCount;
    }

    public Timestamp getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(Timestamp lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getCommunityName() {
        return communityName;
    }

    public void setCommunityName(String communityName) {
        this.communityName = communityName;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }
}
